package org.ghost.http.testkit.common.exception;

import org.ghost.http.testkit.common.errorcode.SystemErrorCodeEnum;
import org.slf4j.Logger;

import java.io.Serializable;

/**
 * 参数错误
 *
 * @author wendfan
 * Created by wendfan on 2017/2/22.
 */
public class ParamErrorException extends MemberCenterException implements Serializable {
    private static final long serialVersionUID = 5036824390997812567L;

    /*
     **
     * 默认提示语句
     */
    private static final String DEFAULT_SUFFIX = "参数不存在";

    public ParamErrorException(String message) {
        this(message, DEFAULT_SUFFIX);
    }

    public ParamErrorException(String methodName, Logger logger) {
        this(methodName, "", logger);
    }

    public ParamErrorException(String methodName, String param, Logger logger) {
        super(methodName, SystemErrorCodeEnum.PARAM_ERROR.getCode(), String.format("%s %s%s", methodName, param,
                DEFAULT_SUFFIX), logger);
    }

    public ParamErrorException(String message, String suffix) {
        this(SystemErrorCodeEnum.PARAM_ERROR.getCode(), message, suffix);
    }

    public ParamErrorException(String code, String message, String suffix) {
        super(code, message + suffix);
    }
}
